﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace IOT4Week1Day1.EFCore.Migrations
{
    public partial class AddDictModel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "DictDatas",
                columns: table => new
                {
                    DId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    KId = table.Column<int>(type: "int", nullable: false),
                    DictDataName = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
                    DictDataCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DictDatas", x => x.DId);
                });

            migrationBuilder.CreateTable(
                name: "DictKeys",
                columns: table => new
                {
                    KId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DictName = table.Column<string>(type: "nvarchar(30)", maxLength: 30, nullable: false),
                    DictCode = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
                    Remark = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DictKeys", x => x.KId);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "DictDatas");

            migrationBuilder.DropTable(
                name: "DictKeys");
        }
    }
}
